﻿cmake_minimum_required(VERSION 3.5)

project(TestOpengl VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
  
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set(ProgramName TestOpengl)
  
include_directories(
	${Third_GLEW}/include
	${Third_GLFW}/include
	${Third_GLM}/include
    )

link_directories(
${Third_GLEW}/lib
${Third_GLFW}/lib
${Third_GLM}/lib
)

add_executable(${ProgramName}
	fshaderSource.txt
	main.cpp
	MyOpenGL.cpp
	MyOpenGL.h
	MyOpenGL.ui
	OpenGLTestQt.cpp
	OpenGLTestQt.h
	OpenGLTestQt.qrc
	OpenGLTestQt.ui
	Resource.qrc
	Utils.cpp
	Utils.h
	vshaderSource.txt
)

if(UNIX)
	set(LIB_PTHREAD -pthread)
endif()

target_link_libraries(${ProgramName} 
PRIVATE glew32
PRIVATE glfw3
PRIVATE opengl32
PRIVATE Qt5::Core
PRIVATE Qt5::Gui
PRIVATE Qt5::Widgets
)
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
target_compile_definitions(RX3D PRIVATE RX3D_LIBRARY)
